<?
class Maillist_Form_Post extends Zend_Form{
    public function init(){
		$translator = new Zend_Translate(
          'array',
          APPLICATION_PATH.'/../library/Nippy/languages/lang.ru.php',
          'ru',
          array('scan' => Zend_Translate::LOCALE_DIRECTORY)
        );
		Zend_Validate_Abstract::setDefaultTranslator($translator);
        $this->addElement('text', 'Id', array(
            'label'      => 'ID:',
        	'filters'    => array('StringTrim','StripTags'),
            'required'   => true,
        	'validators' => array('Int')
            )
        );
        $this->addElement('text', 'Subject', array(
            'label'      => 'Subject:',
        	'filters'    => array('StringTrim','StripTags'),
            'required'   => true,
            'validators' => array(array('validator' => 'StringLength', 'options' => array(1, 255)))
            )
        );
        $this->addElement('text', 'Date', array(
			'filters'    => array('StringTrim','StripTags'),
            'required'   => false,
        ));
        $this->addElement('text', 'Text', array(
            'label'      => 'Text:',
        	'filters'    => array('StringTrim'),
            'required'   => true,
            )
        );
        $this->addElement('checkbox', 'Publish', array(
            'required'   => false,
        ));
	}
    public function getValidValues($params){
		$params['Publish'] = isset($params['Publish']) && $params['Publish']? 1 : 0;
		return parent::getValidValues($params);
	}
}
?>